package ac.leedsmet.devmanager.core;

import junit.framework.TestCase;

/**
 * @author Samael Bate
 */
public abstract class AbstractDevManagerTestCase extends TestCase {

    UserManagerImpl userManager;
    ProjectManagerImpl projectManager;
    Project project;
    IssueManagerImpl issueManager;
    StoryManagerImpl storyManager;

    @Override
    protected void setUp() throws Exception {
        userManager = new UserManagerImpl();
        projectManager = new ProjectManagerImpl();
        project = projectManager.createProject("Test Project");
        issueManager = new IssueManagerImpl(project);
        storyManager = new StoryManagerImpl(project);
    }

    @Override
    protected void tearDown() throws Exception {
        // todo - remove/delete the instantiated objects
    }

    protected void givenThereAreMultipleIssues(int amount) {
        for(int counter = 0; counter < amount; counter++) {
            issueManager.createIssue("issue " + counter, "username");
        }
        assert(project.getIssues().size() > 1);
    }

    protected void givenThereAreMultipleStories(int amount) {
        for(int counter = 0; counter < amount; counter++) {
            storyManager.createStory("story " + counter);
        }
        assert(project.getStories().size() > 1);
    }
}
